// run: $exec < input
#include <iostream>
#include <iomanip>

long long const  inf = (1ll) << 44;
int const maxn = 200007;
long long w[maxn], h[maxn];
int l[maxn], r[maxn], left[maxn], right[maxn];
long long ans[maxn];
long long now;
int n;

int main()
{
	std::ios::sync_with_stdio(false);
	while (std::cin >> n) {
		now = 0;
		for (int i = 0; i <= n + 1; i++)
			ans[i] = l[i] = r[i] = left[i] = right[i] = w[i] = h[i] = 0;
		h[0] = h[n + 1] = inf;
		int low = 0;
		for (int i = 1; i <= n; i++) {
			std::cin >> h[i] >> w[i];
			if (h[low] > h[i]) low = i;
			l[i] = i - 1;
			r[i] = i + 1;
		}
		for (int i = 1; i <= n; ) {
			int j = i;
			for (; h[j + 1] < h[j]; j++);
			for (int k = i; k <= j; k++) right[i] = j;
			i = j + 1;
		}
		right[n + 1] = n + 1;
		for (int i = n; i > 0; ) {
			int j = i;
			for (; h[j - 1] < h[j]; j--);
			for (int k = j; k <= i; k++) left[i] = j;
			i = j - 1;
		}
		left[0] = 0;
		for (int i = 1; i <= n; i++) {
			ans[low] = now + w[low];
			if (h[l[low]] < h[r[low]]) {
				now += w[low] * (h[l[low]] - h[low]);
				left[low] = left[l[low]];
				right[low] = l[low];
				l[r[low]] = l[low];
				r[l[low]] = r[low];
				w[l[low]] += w[low];
				while (ans[low]) low = left[low];
			} else {
				now += w[low] * (h[r[low]] - h[low]);
				right[low] = right[r[low]];
				left[low] = r[low];
				l[r[low]] = l[low];
				r[l[low]] = r[low];
				w[r[low]] += w[low];
				while (ans[low]) low = right[low];
			}
		}
		std::cout << ans[1];
		for (int i = 2; i <= n; i++)
			std::cout << ' ' << ans[i];
		std::cout << '\n';
	}
}


